package system.student.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import system.student.entity.TrainingBudget;
import system.student.entity.TrainingPlan;

import java.util.List;

public interface TrainingPlanMapper {

    /**
     * 添加培养计划
     * @param trainingPlan
     */
    @Insert("insert training_plan(plan_name,dept_id,dept_name,status) values(#{planName},#{deptId},#{deptName},#{status})")
    void addTrainingPlan(TrainingPlan trainingPlan);

    /**
     * 查询所有培养计划
     * @return
     */
    List<TrainingPlan> findAllTrainingPlan();

    /**
     * 删除培养计划
     * @param trainingPlanId
     */
    @Delete("delete from training_plan where id = #{trainingPlanId}")
    void deleteTrainingPlan(Long trainingPlanId);

    /**
     * 添加培养预算
     * @param trainingBudget
     */
    @Insert("insert into training_budget(plan_id, budget_category, money) values(#{planId}, #{budgetCategory}, #{money})")
    void addTrainingBudget(TrainingBudget trainingBudget);

    /**
     * 查询培养预算
     */
    @Select("select * from training_budget")
    List<TrainingBudget> findAllTrainingBudget();

    /**
     * 删除培养预算
     * @param planId
     */
    @Delete("delete from training_budget where plan_id = #{planId}")
    void deleteTrainingBudget(long planId);
}
